package com.ciwong.epaper.util;

import android.app.Activity;
import android.content.Intent;
import android.util.Log;

import com.ciwong.epaper.ui.DialogActivity;
import com.ciwong.epaper.ui.GuideActivity;
import com.ciwong.epaper.ui.MainActivity;
import com.ciwong.epaper.ui.NewLoginActivity;
import com.ciwong.epaper.ui.RegisterActivity;
import com.ciwong.mobilelib.utils.BaseJumpManager;

/**
 * ${todo} Description of class。
 * <p>
 * ${todo} Detail Description
 * <p>
 * ${todo} Sample Code
 * <p>
 * <pre>
 * </pre>
 *
 * @author bin
 * @version ciwong v.1.0 2015/7/25 9:53
 * @since ciwong v.1.0
 */
public class EJumpManager extends BaseJumpManager {
    /**
     * 跳转到注册账号
     *
     * @param goBackId 返回按钮的文字id
     * @param act      启动activity
     * @param
     */
    public static void jumpToRegister(int goBackId, Activity act, String verityCode, String phonenumber) {
        Intent intent = getBaseIntent(goBackId, act, RegisterActivity.class);
        intent.putExtra(IntentFlag.INTENT_FLAG_STR, phonenumber);
        intent.putExtra(IntentFlag.INTENT_FLAG_SMS, verityCode);
        act.startActivity(intent);
    }

    /**
     * 跳转到主界面
     *
     * @param goBackId 返回按钮的文字id
     * @param act      启动activity
     */
    public static void jumpToMain(int goBackId, Activity act) {
        if (!act.isFinishing()) {
            Log.e("TAG", "jumpToMain: ");
            Intent intent = getBaseIntent(goBackId, act, MainActivity.class);
            act.startActivity(intent);
        }
    }

    public static void jumpToLogin(int goBackId, Activity act) {
        if (!act.isFinishing()) {
            Intent intent = getBaseIntent(goBackId, act, NewLoginActivity.class);
            act.startActivity(intent);
        }
    }


    /**
     * 跳转到弹框
     *
     * @param act
     */
    public static void jumpToDialogActivity(Activity act) {
        if (act != null && !act.isFinishing()) {
            Intent intent = getBaseIntent(0, act, DialogActivity.class);
            act.startActivity(intent);
        }
    }


    /**
     * 跳转到引导页面
     *
     * @param goBackId
     * @param context
     */
    public static void jumpToGuide(int goBackId, Activity context) {
        Intent intent = getBaseIntent(goBackId, context, GuideActivity.class);
        context.startActivity(intent);

    }
}
